<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
  <th:block th:include="include :: header('代码生成配置项')"/>
  <th:block th:include="include :: select2-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
  <form class="form-horizontal m" id="form-config-edit">
    <div class="form-group">
      <label class="col-sm-3 control-label">作者：</label>
      <div class="col-sm-8">
        <input id="gen_author" name="gen_author" th:value="${@config.getKey('gen_author')}" class="form-control"
               type="text" required>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-3 control-label">包名：</label>
      <div class="col-sm-8">
        <input id="gen_package_name" name="gen_package_name" th:value="${@config.getKey('gen_package_name')}"
               class="form-control" type="text" required>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-3 control-label">代码生成模版：</label>
      <div class="col-sm-8" th:with="type=${@dict.getType('template_type')}">
        <div class="radio-box" th:each="dict : ${type}">
          <input type="radio" name="gen_template" th:value="${dict.dictValue}"
                 th:attr="checked=${dict.dictValue eq @config.getKey('gen_template')}">
          <label th:text="${dict.dictValue}"></label>
        </div>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-3 control-label">是否去除表前缀：</label>
      <div class="col-sm-8" th:with="type=${@dict.getType('sys_yes_no')}">
        <div class="radio-box" th:each="dict : ${type}">
          <input type="radio" name="gen_auto_remove_pre" th:value="${dict.dictValue}"
                 th:attr="checked=${dict.dictValue eq @config.getKey('gen_auto_remove_pre')}">
          <label th:text="${dict.dictLabel}"></label>
        </div>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-3 control-label">是否启用swagger注解：</label>
      <div class="col-sm-8" th:with="type=${@dict.getType('sys_yes_no')}">
        <div class="radio-box" th:each="dict : ${type}">
          <input type="radio" name="gen_swagger_enable" th:value="${dict.dictValue}"
                 th:attr="checked=${dict.dictValue eq @config.getKey('gen_swagger_enable')}">
          <label th:text="${dict.dictLabel}"></label>
        </div>
      </div>
    </div>
  </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<script type="text/javascript">
  var prefix = ctx + "system/config";

  $("#form-config-edit").validate({
    onkeyup: false,
    focusCleanup: true
  });

  function submitHandler() {
    if ($.validate.form()) {
      $.operate.save(prefix + "/edit/batch", $('#form-config-edit').serialize());
    }
  }
</script>
</body>
</html>
